﻿namespace Alkitab
{
    using Microsoft.Phone.Controls;
    using System;
    using System.Windows;

    public partial class SettingPage : PhoneApplicationPage
    {
        #region Fields

        private bool[] settingX = { false, false, false, false, false };

        #endregion Fields

        #region Constructors

        public SettingPage()
        {
            InitializeComponent();
            for (int i = 0; i < 5; i++)
            {
                if ((((String)Globals.Settingan["parallelRead"])[i]).Equals('1')) settingX[i] = true;
            }
            ITB.IsChecked = settingX[0];
            BSH.IsChecked = settingX[1];
            MLB.IsChecked = settingX[2];
            ASV.IsChecked = settingX[3];
            KJV.IsChecked = settingX[4];
            mazmurSwitch.IsChecked = (bool)Globals.Settingan["mazmurOn?"];
        }

        #endregion Constructors

        #region Methods

        private void MazmurSwitch_Click(object sender, RoutedEventArgs e)
        {
            Globals.Settingan["mazmurOn?"] = (bool)mazmurSwitch.IsChecked;
        }

        private void TranslationSwitch_Click(object sender, RoutedEventArgs e)
        {
            settingX[0] = (bool)ITB.IsChecked;
            settingX[1] = (bool)BSH.IsChecked;
            settingX[2] = (bool)MLB.IsChecked;
            settingX[3] = (bool)ASV.IsChecked;
            settingX[4] = (bool)KJV.IsChecked;
            String temp = "";
            for (int i = 0; i < 5; i++)
            {
                if (settingX[i]) temp += "1"; else temp += "0";
            }
            Globals.Settingan["parallelRead"] = temp;
        }

        #endregion Methods
    }
}